#!/usr/bin/env python
# -*- coding: utf-8 -*-
from urllib.parse import quote
ENVIROMENT = 'DEVELOP'# DEVELOP：开发环境 PRODUCT：生产环境
CLIENT_TZ = 'Asia/Shanghai'  # 客户端时区

if ENVIROMENT == 'PRODUCT':# 生产环境
    SECRET_KEY = 'wlmqOdoo@2022#XJ'# JWT Key
    ODOO_HOST = "chanke-odoo"
    ODOO_PORT = 8069
    ODOO_DB = "chanke"
    ODOO_USERNAME = "admin"
    ODOO_PASSWORD = "Admin2023$!#"
    # 缓存
    CACHE_MEMCACHED_SERVERS = ['chanke-memcache:11211']  # Memcached缓存节点，注意使用容器内端口
    CACHE_MEMCACHED_EXPTIME = 7200  # 这里单位是秒，定义默认超时时间为2小时
    # 本地临时文件
    TEMP_PATH = "/www/temp_file"
    DOWN_FILE_DIR = '/www/temp_file/'

    HOST = '140.246.134.213'
    PORT = 5436
    DATABASE = 'chanke'
    USERNAME = 'odoo'
    PASSWORD = 'Odoo!Db@2023$'
    DB_URI = "postgresql://{username}:{password}@{host}:{port}/{db}?charset=utf8".format(username=USERNAME,
                                                                                            password=PASSWORD,
                                                                                            host=HOST, port=PORT,
                                                                                            db=DATABASE)
    # 连接数据库
    SQLALCHEMY_DATABASE_URI = DB_URI

else:# 开发环境
    SECRET_KEY = 'wlmqOdoo@2022#XJ'# JWT Key
    ODOO_HOST = "140.246.134.213"
    ODOO_PORT = 8073
    ODOO_DB = "chanke"
    ODOO_USERNAME = "admin"
    ODOO_PASSWORD = "Admin2023$!#"
    # 缓存
    CACHE_MEMCACHED_SERVERS = ['localhost:11211']  # Memcached缓存节点
    CACHE_MEMCACHED_EXPTIME = 7200  # 这里单位是秒，定义默认超时时间为2小时
    # 本地临时文件
    TEMP_PATH = "d:/temp"
    DOWN_FILE_DIR = 'down_file/'

    HOST = '140.246.134.213'
    PORT = 5436
    DATABASE = 'chanke'
    USERNAME = 'odoo'
    PASSWORD = 'Odoo!Db@2023$'
    DB_URI = f"postgresql://{USERNAME}:{quote(PASSWORD)}@{HOST}:{PORT}/{DATABASE}"
    # 连接数据库
    SQLALCHEMY_DATABASE_URI = DB_URI
